Refresh.Web.HTML = {	
	create: function(type,atts,text) {
		var el = document.createElement(type);		
		this.applyAttributes(el,atts);
		
		if (text) {
			if (!text.match(/</g)) {
				this.addText(el,text);
			} else {
				el.innerHTML = text;
			}
		}
		return el;
	},
	append: function (parent,type,atts,text) {
		var el = this.create(type,atts,text);
		parent.appendChild(el);
		return el;
	},
	applyAttributes: function(el,atts) {
		if (atts) {
			for (att in atts)
				el[att] = atts[att];
		}
	},
	addText: function(el,text)  {
		var t = document.createTextNode(text);
		el.appendChild(t);	
	},
	text: function(el,text)  {
		this.clear(el);
		this.addText(el,text);	
	},
	clear: function(el)  {
		while(el.childNodes.length>0)
			el.removeChild(el.childNodes[el.childNodes.length-1]);
		return el;	
	}	
};

